﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace DevDemo
{
    public partial class Dev_GridControl : DevExpress.XtraEditors.XtraForm
    {
        public Dev_GridControl()
        {
            InitializeComponent();

            GetData();
        }

        public void GetData()
        {
            //创建一个空表
            DataTable dt = new DataTable();

            
            dt.Columns.Add("column0", System.Type.GetType("System.String"));
            dt.Columns.Add("column1", System.Type.GetType("System.String"));
            dt.Columns.Add("column2", System.Type.GetType("System.String"));
            

            for (int i = 0; i < 5; i++)
            {
                dt.Rows.Add("张三" + i, "李四" + i, "王五" + i);
            }

            DataTable dt1 = dt.Clone();

            DataRow dr = dt1.NewRow();

            dr.ItemArray = dt.Rows[0].ItemArray;

            dt1.Rows.Add(dr);

            this.gridControl1.DataSource = dt1;
        }

        private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            
        }

        private void gridView1_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            string str = e.Value.ToString();
        }

        private void gridView1_MouseDown(object sender, MouseEventArgs e)
        {
            Point p = e.Location;

            string X = p.X.ToString();

            string Y = p.Y.ToString();

            lb.Location = new Point(p.X + 50, p.Y + 50);

        }
    }
}